Ext.define('Admin.view.role.group.RoleGroupGrid', {
    extend: 'Ext.grid.Panel',
    xtype: 'roleGroupGrid',
    id: 'roleGroupGrid',

    title: '用户权限',
    iconCls: 'x-fa fa-edit',

    controller: 'roleGroupViewController',

    viewModel: {
        type: 'roleGroupViewModel'
    },

    bind: '{roleGroup}',

    columns: [{
        header: 'id',
        dataIndex: 'id',
        width: 80,
        sortable: true,
        hidden: true
    }, {
        header: '姓名',
        dataIndex: 'fullname',
        width: 80,
        flex: 1,
        sortable: true
    }, {
        header: '部门',
        dataIndex: 'dept',
        width: 80,
        flex: 1,
        sortable: true
    }, {
        header: '职位',
        dataIndex: 'job',
        width: 80,
        flex: 1,
        sortable: true
    }, {
        header: '角色名',
        dataIndex: 'role',
        width: 80,
        flex: 1,
        sortable: true
    }, {
        header: '操作',
        xtype: 'actioncolumn',
        cls: 'content-column',
        width: 100,
        flex: 1,
        text: '操作',
        items: [{
            xtype: 'button',
            iconCls: 'x-fa fa-edit',
            tooltip: '编辑',
            handler: 'onClickRoleGroupEditButton'
        }]
    }],

    tbar: Ext.create('Ext.toolbar.Toolbar', {
        items: [{
            xtype: 'combobox',
            reference: 'roleGroupQuery',
            queryMode: 'local',
            displayField: 'key',
            valueField: 'value',
            emptyText: '请选择...',
            editable: false,
            store: Ext.create('Ext.data.Store', {
                fields: ['key', 'value'],
                data: [
                    { "key": '姓名', "value": 'fullname' },
                    { "key": '部门', "value": 'dept' },
                    { "key": '职位', "value": 'job' },
                    { "key": '角色', "value": 'role' }
                ]
            })
        }, {
            xtype: 'textfield',
            reference: 'roleSearchQuery',
            emptyText: '关键字'
        }, {
            text: '重置',
            listeners: {
                click: 'onClickRoleGroupGridResetButton'
            }
        }, {
            text: '提交',
            listeners: {
                click: 'onClickRoleGroupGridSearchButton'
            }
        }]
    }),

    bbar: Ext.create('Ext.PagingToolbar', {
        bind: '{roleGroup}',
        displayInfo: true,
        displayMsg: '显示第 {0} - {1} 条数据 总计 {2}',
        emptyMsg: "没有任何数据",
    })
});